<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        svg {
            color: #d93934;
        }
    </style>
</head>
<body>
<svg id="__svg__icons__dom__" xmlns="http://www.w3.org/2000/svg" xmlns:link="http://www.w3.org/1999/xlink">
    <symbol viewBox="0 0 128 128" id="icon-ban">
        <path d="M64 0C28.8 0 0 28.8 0 64s28.8 64 64 64 64-28.8 64-64S99.2 0 64 0zm41.1 97.6L30.4 22.9c9.1-8 20.8-12.3 33.6-12.3 29.3 0 53.3 24 53.3 53.3 0 12.9-4.2 24.6-12.2 33.7zM64 117.3c-29.3 0-53.3-24-53.3-53.3 0-12.8 4.3-24.5 12.3-33.6l75.2 75.2c-9.7 7.5-21.4 11.7-34.2 11.7z"
              style="fill:#d93934"></path>
    </symbol>
</svg>

<svg aria-hidden="true">
    <use href="#icon-ban"/>
</svg>
<script>
    const str = `<?xml version="1.0" encoding="utf-8"?>
    <svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
    y="0px"
    viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
    <path id="床位管理" d="M10.48,60.68h98.09c4.79-0.26,8.88,3.57,9.12,8.55c0.02,0.34,0.02,0.69,0,1.03v18.85H10.48V60.68
 M14.87,34.42h13.31c3.03-0.06,5.61,2.27,5.99,5.39v4.67c-0.38,3.13-2.96,5.46-5.99,5.4H14.87c-2.55-0.11-4.53-2.36-4.42-5.01
c0-0.13,0.01-0.26,0.03-0.39v-5.6c0.06-2.45,1.97-4.43,4.33-4.46H14.87z M5.26,2.21C2.56,2.31,0.33,4.44,0,7.23v113.68
c0.36,2.84,2.77,4.92,5.53,4.78c2.6,0.19,4.86-1.85,5.04-4.55c0.01-0.07,0.01-0.15,0.01-0.22v-20.76h107.21v21.69
c0,2.39,2.13,3.94,5.45,3.94c1.76,0,4.76-0.49,4.76-3.94V69.95c0.04-11.2-8.66-20.32-19.43-20.38H42.02
c1.04-1.79,1.74-3.78,2.03-5.85v-4.67c-0.07-4.17-1.83-8.12-4.86-10.86c-3.02-2.81-6.93-4.37-10.98-4.4H14.91
c-1.58,0.02-3.1,0.53-4.39,1.45V7.23c-0.06-2.68-2.09-4.86-4.66-5.02H5.26"/>
    </svg>
    `
    const reg = /(?<=<svg[^<>]*>)([\s\S]*)(?=<\/svg>)/;
    console.log(reg.exec(str));
    const svgSymbolItem = ''
    const XMLNS = 'http://www.w3.org/2000/svg';
    const XMLNS_LINK = 'http://www.w3.org/1999/xlink';
    const code = `
       if (typeof window !== 'undefined') {
         function loadSvg() {
           var body = document.body;
           var svgEl = document.getElementById('${customDomId}');
           if(!svgEl) {
             svgEl = document.createElement('svg');
             svgEl.style.position = 'absolute';
             svgEl.style.width = '0';
             svgEl.style.height = '0';
             svgEl.id = '${customDomId}';
             svgEl.setAttribute('xmlns','${XMLNS}');
             svgEl.setAttribute('xmlns:link','${XMLNS_LINK}');
           }
           svgEl.innerHTML = ${JSON.stringify(html)};
           // body.insertBefore(svgDom, body.lastChild);
           document.head.appendChild(svgDom);
         }
         if(document.readyState === 'loading') {
           document.addEventListener('DOMContentLoaded', loadSvg);
         } else {
           loadSvg()
         }
      }
        `;
</script>
</body>

<script>

</script>
</html>
